package com.gears_software.sxdc.dccx.ui.util;

import android.content.Context;
import android.view.View;
import android.widget.TextView;

import com.bigkoo.pickerview.OptionsPickerView;

import com.gears_software.sxdc.dccx.data.model.Univalence;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by SunMuran on 2017/7/27.
 */

public class ShowUnivalence {
    private OptionsPickerView univalence;
    private List<Univalence> univalenceItem = new ArrayList<>();

    public void initUnivalence(Context context, final TextView tv) {
        getUnivalence();

        univalence = new OptionsPickerView.Builder(context, new OptionsPickerView.OnOptionsSelectListener() {
            @Override
            public void onOptionsSelect(int options1, int option2, int options3, View v) {
                //返回的分别是三个级别的选中位置
                String tx = univalenceItem.get(options1).getPickerViewText();

                tv.setText(tx);
            }
        })
                .build();

        univalence.setPicker(univalenceItem);//添加数据源
    }

    public void getUnivalence() {
        univalenceItem.add(new Univalence(1, "20元"));
        univalenceItem.add(new Univalence(1, "25快"));
        univalenceItem.add(new Univalence(1, "30毛"));
        univalenceItem.add(new Univalence(1, "35分"));
        univalenceItem.add(new Univalence(1, "40角"));
        univalenceItem.add(new Univalence(1, "50万"));
        univalenceItem.add(new Univalence(1, "111千万"));
    }

    public void univalenceShow() {
        univalence.show();
    }

}
